]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
recorder: Clean up stage lifetime handling
authorRay Strode <rstrode@redhat.com>
Thu, 26 Jul 2012 21:31:11 +0000 (17:31 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 26 Oct 2012 17:29:30 +0000 (13:29 -0400)
The stage is a floating object. We don't own a reference
to it, so we shouldn't unref it.

This commit removes the erroneous unref call and makes sure
we call clutter_actor_destroy on the stage when we're done
with it.

https://bugzilla.gnome.org/show_bug.cgi?id=680647

src/test-recorder.c

index de856f87c91d38fae59cfab1bd09516ca816ca93..69f6f601fc5fbd037c56acb900e359ca6bcde10c 100644 (file)
@@ -11,7 +11,7 @@
 static ShellRecorder *recorder = NULL;
 
 static gboolean
-stop_recording_timeout (gpointer data)
+stop_recording_timeout (ClutterActor *stage)
 {
   if (recorder)
     {
@@ -19,15 +19,16 @@ stop_recording_timeout (gpointer data)
       g_object_unref (recorder);
     }
 
-  clutter_main_quit ();
+  clutter_actor_destroy (stage);
 
   return FALSE;
 }
 
 static void
-on_animation_completed (ClutterAnimation *animation)
+on_animation_completed (ClutterAnimation *animation,
+                        ClutterStage     *stage)
 {
-  g_timeout_add (1000, stop_recording_timeout, NULL);
+  g_timeout_add (1000, (GSourceFunc) stop_recording_timeout, stage);
 }
 
 static void
@@ -69,7 +70,7 @@ int main (int argc, char **argv)
                                     "y", 240.0,
                                     NULL);
   g_signal_connect (animation, "completed",
-                   G_CALLBACK (on_animation_completed), NULL);
+                   G_CALLBACK (on_animation_completed), stage);
 
   text = g_object_new (CLUTTER_TYPE_TEXT,
                       "text", "Blue",
@@ -110,7 +111,5 @@ int main (int argc, char **argv)
 
   clutter_main ();
 
-  g_object_unref (stage);
-
   return 0;
 }